package com.yh.mybatis;

import cn.hutool.core.lang.Console;
import com.alibaba.fastjson.JSON;
import com.yh.mybatis.binding.MapperProxyFactory;
import com.yh.mybatis.dao.IUserDao;

import java.util.HashMap;
import java.util.Map;

public class main {
    public static void main(String[] args) {
        MapperProxyFactory<IUserDao> factory = new MapperProxyFactory<>(IUserDao.class);
        Map<String, String> sqlSession = new HashMap<>();
        sqlSession.put("com.yh.mybatis.dao.IUserDao.queryUserName","模拟执行 Mapper.xml 中 SQL 语句的操作：查询用户姓名");

        IUserDao userDao = factory.newInstance(sqlSession);
        String userName = userDao.queryUserName("1001");

        Console.log("测试结果：", JSON.toJSONString(userName));
    }
}
